import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

//导入pinia中的定义 全局数据的一个函数 defineStore
export const useCounterStore = defineStore('counter', () => {
  //状态变量
  const count = ref(0)
  //计算属性
  const doubleCount = computed(() => count.value * 2)

  //累加count
  function increment() {
    count.value++
  }

  return { count, doubleCount, increment }
})
